<template>
  <div class="title_box">
    <img
      class="title_img"
      :src="require('../assets/imgs/titleImg/' + title + '.png')"
      alt=""
    />
    <span v-if="morePath" @click="handNav()">更多 > </span>
  </div>
</template>

<script lang="ts">
import { defineComponent, reactive, ref, toRef, toRefs } from "vue";
import { useRouter } from "vue-router";
export default defineComponent({
  name: "NavBar",
  props: {
    title: {
      type: String,
      default: "标题",
    },
    morePath: {
      type: String,
      default: "",
    },
  },
  setup(props) {
    const router = useRouter();
    const state = reactive({
      banner: "",
    });
    const handNav = () => {
      if (props.morePath) {
        router.push({
          path: props.morePath,
        });
      }
    };
    return { ...toRefs(state), handNav };
  },
});
</script>
<style lang="scss" scoped>
.title_box {
  display: flex;
  justify-content: space-between;
  span {
    font-size: 14px;
    color: #666666;
  }
  .title_img {
    width: 179px;
    height: 23px;
    margin-bottom: 20px;
  }
}
</style>
